You really don't need main()'s variable ptr. It's not used for anything useful.
As written, that is an infinite loop (assuming y[0] != 0). You need to increment y.Code:int character_repeat(char x, char *y) { int i = 0, count = 0; while (*y != '\0') { if (x[i+1] == x[i]) i++; count++; // Need something more or different } return count; }